<script type="text/javascript">
	var baseUrl = '<?php echo $this->baseUrl('/admin')?>';
	function editUser() {
		if($("#adminForm #id:checked").length == 0) {
			alert("Please select a user.");
			return;
		}
		$("#adminForm #a").val("edit");
		$("#adminForm").submit();
	}

	function deleteUser() {
		if($("#adminForm #id:checked").length == 0) {
			alert("Please select a user.");
			return;
		}
		$("#adminForm #a").val("delete");
		$("#adminForm").attr("action", baseUrl + "?c=user&a=delete");
		$("#adminForm").attr("method", "post").submit();
	}
</script>
<div class="border">
    <div class="padding">
        <div id="toolbar-box">
            <div class="t">
                <div class="t">
                    <div class="t"></div>
                </div>
            </div>
            <div class="m">
                <div id="toolbar" class="toolbar">
                    <table class="toolbar">
                        <tbody>
                        <tr>
                            <td id="toolbar-delete" class="button">
                            	<a class="toolbar" onclick="deleteUser()" href="javascript:;"> 
                            		<span title="Delete" class="icon-32-delete"></span> Delete </a>
                            </td>
                            <td id="toolbar-edit" class="button">
                            	<a class="toolbar" href="javascript:;" onclick="editUser();"> 
                            		<span title="Edit" class="icon-32-edit"> </span> Edit </a>
                            </td>
                            <td id="toolbar-new" class="button">
                            	<a class="toolbar" href="<?php echo $this->baseUrl('/admin') . '?c=user&a=add';?>"> 
                            		<span title="New" class="icon-32-new"> </span> New </a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="header icon-48-user">User Manager</div>
                <div class="clr"></div>
            </div>
            <div class="b">
                <div class="b">
                    <div class="b"></div>
                </div>
            </div>
        </div>
        <div class="clr"></div>


        <div id="element-box">
            <div class="t">
                <div class="t">
                    <div class="t"></div>
                </div>
            </div>
            <div class="m">
                <form name="adminForm" id = "adminForm" method="GET" action="<?php echo $this->baseUrl('/admin') . '?c=user';?>">
                	<input type="hidden" name="a" id="a">
                    <table>
                        <tbody>
                        <tr>
                            <td width="100%">Filter: 
                            	<input type="text" onchange="document.adminForm.submit();" class="text_area" value="" id="search" name="search">
                                <button onclick="this.form.submit();">Go</button>
                            </td>
                            <td nowrap="nowrap">
                            	<?php echo $this->formSelect(
                            		'group_id', 
                            	    $this->params['group_id'], 
                            	    array(
                            	        'onchange' => 'this.form.submit();'
                            	    ), 
                            	    $this->groups) ?>
                            </td>
                        </tr>
                        </tbody>
                    </table>
	                <?php echo $this->grid->render();?>
                    <div class="clr"></div>
                    <input type="hidden" name="<?php echo Lua_Constant_General::PARAM_CONTROLLER?>" value='user' />
                </form>
            </div>
            <div class="b">
                <div class="b">
                    <div class="b"></div>
                </div>
            </div>
        </div>
        <noscript>Warning! JavaScript must be enabled for proper operation of
            the Administrator back-end.
        </noscript>
        <div class="clr"></div>
    </div>
    <div class="clr"></div>
</div>